﻿<%@ Page Title="" Language="C#" MasterPageFile="~/WithoutPermBasic.Master" AutoEventWireup="true" CodeBehind="Storage.aspx.cs" Inherits="StorageManage.UI.Storage" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
        $(function () {
            var height = $("#divTotal").height();
            var master = $("#master").height();
            var content = parseFloat(height) - parseFloat(master) - 30;            
            $("#tbList").css("height", content);

            $(document).keydown(function (event) {
                if (event.keyCode == 13) {
                    funcSearch();
                }
            });
            $('#HmCode').combobox('textbox').keydown(function (e) {
                if (e.keyCode == 13) {
                   
                    funcSearch();
                }
            })
            $('#tbList').datagrid({
                url: '/Logic/StorageIn.aspx?method=GetStorageList',
                loadMsg: '数据加载中请稍后......',
                pagination: true,
                rownumbers: true,
                singleSelect: false,
                footPager: true,
                pageSize: 100,
                queryParams: com.serializeSearchArray("form1"),
                pageList: [20, 50, 100],
                columns: [[
                     { field: 'ck', checkbox: true, width: 30 },
                     
                     { field: 'HmCode', title: '助记码', width: 100, align: "center", },
                     { field: 'MaterialCode', title: '物料编码', width: 100, align: "center", },
                     { field: 'Name', title: '物料名称', width: 100, align: "center", },
                     { field: 'Guige', title: '规格', width: 100, align: "center", },
                     { field: 'Caizhi', title: '材质', width: 100, align: "center", },
                     { field: 'PurcUnit', title: '单位', width: 30, align: "center", },
                     { field: 'ZhangNum', title: '张数', width: 30, align: "center", },
                     { field: 'TotalWeight', title: '总重', width: 100, align: "center", },
                     { field: 'Length', title: '长', width: 100, align: "center", },
                     { field: 'Width', title: '宽', width: 100, align: "center", },
                     { field: 'InCode', title: '入库编号', width: 100, align: "center", },
                     { field: 'TaskCode', title: '生产制号', width: 100, align: "center", },
                     { field: 'Note', title: '备注', width: 100, align: "center", },
                     { field: 'Warehouse', title: '仓库', width: 100, align: "center", },
                     {
                         field: 'MaterialType', title: '物料类型', width: 80, align: "center"
                         
                     },
                ]],
               
            });
            if (com.get.action == "addOutDetail") {
                $('#btnAddOutDetail').css('display', 'inline-block');
                $('#btnAdd').css('display', 'none')
                $('#btnExportExcel').css('display', 'none');
            }
        })
    </script>
    <script type="text/javascript">
        function funcSearch() {
            var para = com.serializeSearchArray('form1');
            $('#tbList').datagrid('load', para);
        }      
        function funcReload() {
            $('#form1').form('clear');
        }
        function funcAdd() {
            var rows = $('#tbList').datagrid('getSelections');
            var row = $('#tbList').datagrid('getSelected');
            if (row) {
                var ids = "";
                for (var i = 0; i < rows.length; i++) {
                    ids += (rows[i].Id + ",");
                }
                top.wrapper.addTab('余料出库单', '/UI/StorageOutDetail.aspx?ids=' + ids);
            } else {
                com.message('information', '请至少选中一行');
            }
        }
        function funcAddOutDetail() {
            
            ids = com.get.ids;
            //为编辑状态下进入新增条目
            
            var rows = $('#tbList').datagrid('getSelections');
            if (ids == '0') {
                com.ajax({
                    url: '/Logic/StorageOut.aspx?method=InsertStorageOut&outCode='+com.get.outCode,
                    data: { info: JSON.stringify(rows) },
                    success: function (data) {
                        if (data.state=='success') {
                            top.wrapper.addTab('余料出库单', '/UI/StorageOutDetail.aspx?action=edit&outCode=' + com.get.outCode);
                        }
                    }
                });
            } else {
                for (var i = 0; i < rows.length; i++) {
                    ids += (rows[i].Id + ",");
                }
                top.wrapper.addTab('余料出库单', '/UI/StorageOutDetail.aspx?ids=' + ids);
            }
            
        }
        function funcExportExcel() {
            var para = com.serializeSearchArray1('form1');
            top.wrapper.addTab('导出', '/ExportModel/ExportStorage.aspx?searchData=' + para);
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceToorbar" runat="server">
     <a href="javascript:void(0)" id="btnSearch" class="easyui-linkbutton" onclick="funcSearch()"
        data-options="iconCls:'icon-search'">查询</a>
     <a href="javascript:void(0)" id="btnReload" class="easyui-linkbutton" onclick="funcReload()"
        data-options="iconCls:'icon-reload'">重置</a>
     <a href="javascript:void(0)" id="btnAdd" class="easyui-linkbutton" onclick="funcAdd()"
        data-options="iconCls:'icon-add'">余料出库</a>
     <a href="javascript:void(0)" id="btnAddOutDetail" class="easyui-linkbutton" onclick="funcAddOutDetail()"
        data-options="iconCls:'icon-add'" style="display:none">添加条目</a>
    <a href="javascript:void(0)" id="btnExportExcel" class="easyui-linkbutton" onclick="funcExportExcel()"
        data-options="iconCls:'icon-ext-xls'">导出Excel</a>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
     <div id="master" class="container_16" style="height: auto; float: left;"">
         <form id="form1">           
             <div class="grid_2 sealbl" style="text-align: right;">
                生产制号:
            </div>
            <div class="grid_2 seaval" style="text-align: left;">
                <input id="TaskCode" name="TaskCode" data-cp="co" class="easyui-combobox" data-options="valueField:'value', textField:'text',url:'/Logic/StorageIn.aspx?method=GetTaskCode',mode:'remote',panelHeight:'200'" />
            </div>
             <div class="grid_2 sealbl" style="text-align: right;">
                助记码:
            </div>
            <div class="grid_2 seaval" style="text-align: left;">
                <input id="HmCode" name="HmCode" data-cp="co" class="easyui-combobox" data-options="valueField:'value', textField:'text',url:'/Logic/StorageIn.aspx?method=GetHmCode',mode:'remote',panelHeight:'200'" />
            </div>
             <div class="grid_2 sealbl" style="text-align: right;">
                入库编号:
            </div>
            <div class="grid_2 seaval" style="text-align: left;">
                <input id="InCode" name="InCode" data-cp="co" />
            </div>
             </form>
     </div>
    <table id="tbList" title="库存查询" style="width: 100%">
        </table>
</asp:Content>
